﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


abstract public class UI_Popup_Base : MonoBehaviour
{
    public enum PopupActionType
    {
        PopupShow,
        PopupClose,
    }
    abstract public bool isDestoryByClose { get; }//关闭的时候是否直接删除

    public bool isCloseByBG;//是否通过点击背景关闭

    public bool isOverrideOther;//是否直接覆盖其他弹窗

    virtual public void OnEnable()
    {
        EventManager.Instance.DispatchEvent(PopupActionType.PopupShow.ToString(), this);
    }
    virtual public void OnClose()
    {
        if (isDestoryByClose)
        {
            this.gameObject.SetActive(false);
        }
        else
        {
            Destroy(this.gameObject);
        }
        EventManager.Instance.DispatchEvent(PopupActionType.PopupClose.ToString(), this);
    }
}
abstract public class UI_Popup_Base<T>: UI_Popup_Base where T : UI_Popup_Base<T>
{
    
    abstract public T Init(params object[] objects);


   


}
